package com.yjhb.android.sbz.mvp.sys;

import com.yjhb.android.sbz.entity.ResultSet;
import com.yjhb.android.sbz.entity.SystemAnnouncement;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

/**
 * 创建者 zx
 * 创建时间 2021/1/12 9:10
 */
public class SystemAnnouncementPresenter extends ConventionPresenter<SystemAnnouncementView> {
    private final String TAG = "SystemAnnouncementPresenter";

    @Override
    protected void onDestroy() {

    }

    public SystemAnnouncementPresenter(SystemAnnouncementView systemAnnouncementView) {
        super(systemAnnouncementView);
    }


    /**
     * 系统公告
     *
     * @param size
     * @param current
     */
    public void getSystemNotice(int size, int current) {
        HttpTool.request(model.getSystemNotice(size, current), new HttpObserver<ResultSet<SystemAnnouncement>>() {
            @Override
            public void onResult(ResultSet<SystemAnnouncement> data) {
                if (view != null) {
                    view.onLoad(data.getRecords(), current == 1);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }
}
